package javafeature.reflect;

import java.lang.reflect.Constructor;

/**
 * 测试Constructor类
 */
public class TestConstructor {
    public static void main(String[] args) throws Exception {
        String str = "abc";
        Class<?> cls1 = str.getClass();
        Class<?> cls2 = String.class;
        Class<?> cls3 = Class.forName("java.lang.String");
        Constructor constructor = cls1.getConstructor(StringBuffer.class);
        String sstr = (String) constructor.newInstance(new StringBuffer("aabc"));
        System.out.println(sstr);
    }
}
